import { createStore } from 'iostore';
import GxlTableSheet from '../index';
createStore({
  namespace: 'SheetStore',
  currentSheetIndex:0,
  currentSheetData: undefined,
  sheets:[new GxlTableSheet('untitled')],
  currentSheet(){
    if(!this.currentSheetData){
      this.currentSheetData = this.sheets[this.currentSheetIndex]
    }
    return this.currentSheetData
  },
  switchSheetTo(sheetIndex){
    const toSheet = this.sheets[sheetIndex]
    if(toSheet){
      this.currentSheetData = toSheet;
      this.currentSheetIndex = sheetIndex;
    }
  }
});